<?php
include_once 'dbconnect.php';
include_once 'url.conf.php';
include_once 'function.general.php';
$sql = new ownedsql();

function displayCompany()
{
    global $sql, $upload;

    $sql->connect();
    $sql->query("SELECT 3i_job_assoc.uid,sName,fName,jobName,phone,email  FROM 3i_userdetails LEFT JOIN 3i_job_assoc ON 3i_job_assoc.uid=3i_userdetails.uid LEFT JOIN 3i_jobs ON 3i_jobs.jobid=3i_job_assoc.jobid LEFT JOIN 3i_usernames ON 3i_usernames.uid=3i_userdetails.uid WHERE uActive='1' AND NOT 3i_jobs.jobName='referens'  ORDER BY sName DESC");
    $result1 = $sql->query;
    $sql->query("SELECT 3i_job_assoc.uid,sName,fName,jobName,phone,email  FROM 3i_userdetails LEFT JOIN 3i_job_assoc ON 3i_job_assoc.uid=3i_userdetails.uid LEFT JOIN 3i_jobs ON 3i_jobs.jobid=3i_job_assoc.jobid LEFT JOIN 3i_usernames ON 3i_usernames.uid=3i_userdetails.uid WHERE uActive='1' AND 3i_jobs.jobName='referens'  ORDER BY sName ASC");
    $result2=$sql->query;
    $sql->kill();

    while ($item = mysql_fetch_array($result1)) {
        $img = $upload . "images/profile/" . $item['uid'] . "/thumb.jpg";
?>
       <div id="boxCard">
                    <div id="text">
                        <span id="cardName"><?php echo $item['sName'] . " " . $item['fName'] ?></span><br />
                        <span id="cardJob"><?php echo $item['jobName'] ?></span><br />
                        <?php echo $item['phone']; ?><br />
                        <?php echo safeEmail($item['email']) ?><br />
                    </div>
                    <div id="img"><img src="<?php
        if (file_exists($img)) {
            echo "core/function.pimage.download.php?uid=" . $item['uid'];
        } else {
            echo "imgs/blank-user.jpg";
        }
?>" /></div>
                </div>
       <?php
    }
    
    while ($item = mysql_fetch_array($result2)) {
        $img = $upload . "images/profile/" . $item['uid'] . "/thumb.jpg";
?>
       <div id="boxCard">
                    <div id="text">
                        <span id="cardName"><?php echo $item['sName'] . " " . $item['fName'] ?></span><br />
                        <span id="cardJob"><?php echo $item['jobName'] ?></span><br />
                        <?php echo $item['phone']; ?><br />
                        <?php echo safeEmail($item['email']) ?><br />
                    </div>
                    <div id="img"><img src="<?php
        if (file_exists($img)) {
            echo "core/function.pimage.download.php?uid=" . $item['uid'];
        } else {
            echo "imgs/blank-user.jpg";
        }
?>" /></div>
                </div>
       <?php
    }

}
?>